package com.bg.sparkproject.pattern.single.hungry;

/**
 * @Auther: zhengshunzhi
 * @Date: 2019/1/3 16:19
 * @Description: 单例模式 饿汉式 ，在SingletonHolder初始化的时候会由ClassLoader来保证同步，使INSTANCE是一个真·单例
 */
public class HungryCreat {
    private static final HungryCreat hungeyCreat = new HungryCreat();

    private HungryCreat() {
        System.out.println("单例模式饿汉式创建");
    }
    public static HungryCreat getInstance(){
        return hungeyCreat;
    }

    public static void main(String[] args) {
        HungryCreat.getInstance();
    }
}
